﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class TeacherEvalCatchLogic : CommonLogic<TeacherEvalCatch, int>, ITeacherEvalCatchLogic
    {
        #region Implementation of ICommonLogic<TeacherEvalCatch, int>

        /// <summary>
        /// 创建对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(TeacherEvalCatch entity)
        {
            return CreateObject(entity);
        }

        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(TeacherEvalCatch entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public int Delete(int entityId)
        {
            return DeleteObject(entityId);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll()
        {
            return DeleteAllObject();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public TeacherEvalCatch FindById(int entityId)
        {
            return FindObjectById(entityId);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount()
        {
            return FindObjectByCount();
        }

        /// <summary>
        /// 检索对象
        /// </summary>
        public IList<TeacherEvalCatch> FindAll()
        {
            return FindAllObject();
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <summary>
        /// 检索对象
        /// </summary>
        public IList<TeacherEvalCatch> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion


        /// <summary>
        /// 插入记录
        /// </summary>
        /// <param name="mpc"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int InsertTeacherEvalCatch(TeacherEvalCatch mpc, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("TeacherEvalCatch", mpc);
            ht.Add("SchoolMark", schoolMark);
            return (int)InsertCustomer("TeacherEvalCatch.InsertTeacherEvalCatch", ht);
        }


        /// <summary>
        /// 删除缓存表中对应单据及学生的记录
        /// </summary>
        /// <param name="studentID"></param>
        /// <param name="recordID"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int DeleteTeacherEvalCatch(int teacherID, int recordID, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("TeacherID", teacherID);
            ht.Add("RecordID", recordID);
            ht.Add("SchoolMark", schoolMark);
            return DeleteCustomer("TeacherEvalCatch.DeleteTeacherEvalCatch", ht);
        }
        /// <summary>
        /// 获取评估分数
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>
        public IList<UserProjectScore> FindKeyWordUserScore(Hashtable th)
        {
            try
            {
                string statementName = "TeacherEvalCatch.FindKeyWordUserScore";
                return ExecuteQueryForList<UserProjectScore>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        /// <summary>
        /// 类别信息
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>

        public IList<TeacherEvalType> FindKeyWordTypeInfo(Hashtable th)
        {
            try
            {
                string statementName = "TeacherEvalCatch.FindKeyWordTypeInfo";
                return ExecuteQueryForList<TeacherEvalType>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 题目信息
        /// </summary>
        /// <param name="th"></param>
        /// <returns></returns>
        public IList<TeacherEvalItem> FindKeyWordItemInfo(Hashtable th)
        {
            try
            {
                string statementName = "TeacherEvalCatch.FindKeyWordItemInfo";
                return ExecuteQueryForList<TeacherEvalItem>(statementName, th);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 获取月份评估信息
        /// </summary>
        /// <returns></returns>
        public IList<UserProjectScore> FindKeyWordMonthInfo(Hashtable ht)
        {
            try
            {
                string statementName = "TeacherEvalCatch.FindKeyWordMonthInfo";
                return ExecuteQueryForList<UserProjectScore>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public IList<YearAndMonth> FindKeyWordYearMonth(Hashtable ht)
        {
            try
            {
                string statementName = "TeacherEvalCatch.FindKeyWordYearMonth";
                return ExecuteQueryForList<YearAndMonth>(statementName, ht);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
}
